package ops.view;

import java.awt.FlowLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;

import ops.i18n.Resources;

public class LoginStatusPanel extends JPanel {

	private JLabel statusLabel;
	
	public LoginStatusPanel() {
		super(new FlowLayout(FlowLayout.CENTER, 5,5));
		
		init();
	}

	private void init() {
		statusLabel = new JLabel();
		
		add(statusLabel);
		
		nobodyLoggedIn();
	}
	
	public void changeStatus(String user) {
		Resources resources = Resources.getInstance();
		
		statusLabel.setText(resources.getFormattedString("login.status", user)); 
	}
	
	public void nobodyLoggedIn() {
		changeStatus("");
	}
}
